{include file="public/meta" /}
<title>基本设置</title>
</head>

<body>
    <!--_header 作为公共模版分离出去-->
    {include file="public/header" /}
    <!--/_header 作为公共模版分离出去-->
    <!--_menu 作为公共模版分离出去-->
    {include file="public/leftmenu" /}
    <script>
        $(function() {
            var height = $(window).height();
            var height1 = height - 114;
            $(".page-container").height(height1);
        });
    </script>
    <!--/_menu 作为公共模版分离出去-->
    <link href="__LIB__/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
    <script src="__LIB__/plupload.full.min.js"></script>
    <section class="Hui-article-box">
        <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
            <span class="c-gray en">&gt;</span> 系统管理
            <span class="c-gray en">&gt;</span> 基本设置
            <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
        </nav>
        <div class="page-container" style="overflow-x: hidden;">
            <form class="form form-horizontal" id="form-article-add" method="post">
                <div id="tab-system" class="HuiTab">
                    <div class="tabBar cl">
                        <span>基本设置</span>
                        <!-- <span>系统设置</span> -->
                        <span>微信配置参数</span>
                        <!-- <span>公众号菜单</span> -->
                        <span>短信参数</span>
                    </div>
                    <div class="tabCon">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>网站标题：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" value="{:sysconf('title')}" name="title">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系电话：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" value="{:sysconf('contact')}" name="contact">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>电子邮箱：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" value="{:sysconf('email')}" name="email">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>官方网站：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" value="{:sysconf('website')}" name="website">
                            </div>
                        </div>
                    </div>
                    <!-- <div class="tabCon">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>返佣比例：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" style="width:100px;" value="{:sysconf('distribution_ratio')}" name="distribution_ratio">%
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>提现税收：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" style="width:100px;" value="{:sysconf('cash_cost')}" name="cash_cost">%
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>提现手续费：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" style="width:100px;" value="{:sysconf('cash_tax')}" name="cash_tax">元/每笔
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>签到积分：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                一天 : <input type="text" class="input-text" style="width:100px;" value="{:sysconf('sign_one')}" name="sign_one">
                                两天 : <input type="text" class="input-text" style="width:100px;" value="{:sysconf('sign_two')}" name="sign_two">
                                三天 : <input type="text" class="input-text" style="width:100px;" value="{:sysconf('sign_three')}" name="sign_three"><br/>
                                四天 : <input type="text" class="input-text" style="width:100px;" value="{:sysconf('sign_four')}" name="sign_four">
                                五天 : <input type="text" class="input-text" style="width:100px;" value="{:sysconf('sign_five')}" name="sign_five">
                                六天 : <input type="text" class="input-text" style="width:100px;" value="{:sysconf('sign_six')}" name="sign_six"><br/>
                                七天 : <input type="text" class="input-text" style="width:100px;" value="{:sysconf('sign_seven')}" name="sign_seven">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>抽奖所需积分：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" class="input-text" style="width:100px;" value="{:sysconf('prize_point')}" name="prize_point">个/次
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2">抽奖说明：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <textarea id="content" name="prize_explain" style="height:200px;">{:sysconf('prize_explain')}</textarea>
                            </div>
                        </div>
                    </div> -->


                    <div class="tabCon">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>微信公众号：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('weChat')}" name="weChat" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公众号AppID：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('wx_appid')}" name="wx_appid" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公众号密钥：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('wx_appsercet')}" name="wx_appsercet" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>小程序AppID：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('xwx_appid')}" name="xwx_appid" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>小程序密钥：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('xwx_appsercet')}" name="xwx_appsercet" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>服务器地址：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('wx_url')}" name="wx_url" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>令牌：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('wx_token')}" name="wx_token" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>消息加解密密钥：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('wx_aeskey')}" name="wx_aeskey" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>支付密钥：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('wx_partnerkey')}" name="wx_partnerkey" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>微信支付分配的商户号：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('wx_mchid')}" name="wx_mchid" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>分享图标：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <span class="btn-upload form-group">
				            <input class="input-text upload-url" name="wx_share_icon" value="{:sysconf('wx_share_icon')}" type="text" id="img_url" nullmsg="请添加图片" style="width:400px">
                            <a href="javascript:void(0);" class="btn btn-primary radius upload-btn">
                                <i class="Hui-iconfont">&#xe642;</i> 选择图片
                            </a>
                            <input type="file"  class="input-file" id="img-url-file">
                        </span>
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"></label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <img width="60" class="product-thumb" id="img_show" src="{:sysconf('wx_share_icon')}">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>分享标题：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('wx_share_title')}" name="wx_share_title" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>分享内容：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <textarea name="wx_share_content" class="textarea" placeholder="">{:sysconf('wx_share_content')}</textarea>
                            </div>
                        </div>

                    </div>
                    <!-- <div class="tabCon">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>二维码：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <div class="container">
                                    <div class="uploadbtn">
                                        <a id="btn"></a>
                                    </div>
                                    <div class='upimg_box'>
                                        {if condition="sysconf('wx_qrcode')"}
                                        <img src="{:sysconf('wx_qrcode')}" style="height:108px;" /> {/if}
                                        <div class='sctxt'>
                                    <a href='javascript:void(0);' onclick='test(this)' bindImageUrl="{:sysconf('wx_qrcode')}">删除</a>
                                </div>
                                        <input type="hidden" name="wx_qrcode" value="{:sysconf('wx_qrcode')}">
                                    </div>
                                    <ul id="ul_pics" class="ul_pics clearfix"></ul>
                                </div>
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公众号菜单：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <textarea name="wx_menu" class="textarea" style="height:500px;">{:sysconf('wx_menu')}</textarea>
                            </div>
                        </div>
                    </div> -->
                    <div class="tabCon">
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>短信appkey：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('sms_appkey')}" name="sms_appkey" class="input-text">
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>模版id：</label>
                            <div class="formControls col-xs-8 col-sm-9">
                                <input type="text" value="{:sysconf('sms_tpl_id')}" name="sms_tpl_id" class="input-text">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row cl">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                        <button onClick="article_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
                        <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                    </div>
                </div>
            </form>
        </div>
    </section>
    <!--_footer 作为公共模版分离出去-->
    {include file="public/footer" /}
    <!--/_footer 作为公共模版分离出去-->
    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript" src="__LIB__/ueditor/1.4.3/ueditor.config.js"></script>
    <script type="text/javascript" src="__LIB__/ueditor/1.4.3/ueditor.all.min.js">
    </script>
    <script type="text/javascript" src="__LIB__/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        //创建实例的构造方法
        var uploader = new plupload.Uploader({
            runtimes: 'html5,flash,silverlight,html4',
            browse_button: 'btn',
            url: "{:url('Common/upload')}",
            flash_swf_url: 'plupload/Moxie.swf',
            silverlight_xap_url: 'plupload/Moxie.xap',
            filters: {
                max_file_size: '2mb', //最大上传文件大小（格式100b, 10kb, 10mb, 1gb）
                mime_types: [ //允许文件上传类型
                    {
                        title: "files",
                        extensions: "jpg,png,gif"
                    }
                ]
            },
            multi_selection: false, //true:ctrl多文件上传, false 单文件上传
            init: {
                FilesAdded: function(up, files) { //文件上传前
                    if ($("#ul_pics").children("li").length > 30) {
                        alert("您上传的图片太多了！");
                        uploader.destroy();
                    } else {
                        var li = '';
                        plupload.each(files, function(file) { //遍历文件
                            li += "<li id='" + file['id'] + "'><div class='progress'><span class='bar'></span><span class='percent'>0%</span></div></li>";
                        });
                        $("#ul_pics").append(li);
                        uploader.start();
                    }
                },
                UploadProgress: function(up, file) { //上传中，显示进度条
                    $("#" + file.id).find('.bar').css({
                        "width": file.percent + "%"
                    }).find(".percent").text(file.percent + "%");
                },
                FileUploaded: function(up, file, info) { //文件上传成功的时候触发
                    var data = JSON.parse(info.response);
                    $("#" + file.id).html("<div class='upimg_box'> <img src='" +
                        data.data + "'/><input type='hidden' name='wx_qrcode' value=" +
                        data.data + "></div>");

                },
                Error: function(up, err) { //上传出错的时候触发
                    alert(err.message);
                }
            }
        });
        uploader.init();

        function test(obj) {
            var bindImageUrl = $(obj).attr('bindImageUrl');
            $(obj).parent().parent().css('display', 'none')
            $(obj).parent().next().removeAttr('name');
            // $.post(
            //     "{:url('Common/imageDel')}",
            //     {'imageUrl':bindImageUrl},
            //     function (data) {
            //         if ( data != 1 ){
            //             layer.msg('删除失败');
            //         }
            //     },'json'
            // );
        }
    </script>
    <script type="text/javascript">
        $(function() {
            var ue = UE.getEditor('content');

            $('.skin-minimal input').iCheck({
                checkboxClass: 'icheckbox-blue',
                radioClass: 'iradio-blue',
                increaseArea: '20%'
            });
            $("#tab-system").Huitab({
                index: 0
            });
        });
        $('#img-url-file').change(function() {
            var filess = $('#img-url-file')[0].files[0]
            console.log(filess);
            var fm = new FormData();
            fm.append('image', filess);

            $.ajax({
                type: 'post',
                url: "{:url('Common/uploadImage')}",
                data: fm,
                processData: false,
                contentType: false,
                success: function(data) {
                    //alert(data);
                    var jdata = JSON.parse(data);
                    if (jdata.code == 0) {
                        parent.layer.msg(jdata.msg, {
                            icon: 6,
                            time: 1000
                        });
                        var imgurl = jdata.data;
                        imgurl = imgurl.replace(/\\/g, "/");
                        $('#img_url').val(imgurl);
                        $("#img_show").attr('src', "{:sysconf('website')}/" + imgurl)
                    } else {
                        parent.layer.msg(jdata.msg, {
                            icon: 5,
                            time: 1000
                        });
                    }

                },
                error: function(data) {
                    layer.msg('500系统错误，请重试！', {
                        icon: 5,
                        time: 1000
                    });
                }
            });

        });
    </script>
    <!--/请在上方写此页面业务相关的脚本-->
</body>

</html>